<template>
  <el-card shadow="never" class="aui-card--fill">
    <div class="mod-assets__asset}">
      <el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
        <el-form-item>
          <el-input v-model="dataForm.id" placeholder="id" clearable></el-input>
        </el-form-item>
        <el-form-item>
          <el-button @click="getDataList()">{{ $t('query') }}</el-button>
        </el-form-item>
        <el-form-item>
          <el-button type="info" @click="exportHandle()">{{ $t('export') }}</el-button>
        </el-form-item> 
		<span></span>
        <el-form-item>
          <el-button v-if="$hasPermission('assets:asset:save')" type="primary" @click="addOrUpdateHandle()">{{ $t('add') }}</el-button>
        </el-form-item>
        <el-form-item>
          <el-button v-if="$hasPermission('assets:asset:delete')" type="danger" @click="deleteHandle()">{{ $t('deleteBatch') }}</el-button>
        </el-form-item>
      </el-form>
      <el-table stripe v-loading="dataListLoading" :data="dataList" border @selection-change="dataListSelectionChangeHandle" style="width: 100%;">
        <el-table-column  type="selection" header-align="center" align="center" width="50"></el-table-column>
        <el-table-column sortable prop="status" label="状态" header-align="center" align="center" width="100">
			<template slot-scope="scope">
			  <el-button :icon="scope.row.status==0?'el-icon-check':'el-icon-close'" :type="scope.row.status==0?'primary':'info'" size="small">{{ scope.row.status==0?"闲置":"在用" }}</el-button>
			</template>
		</el-table-column>
		<el-table-column  prop="imageUrl" label="图片" header-align="center" align="center">
			<template slot-scope="scope">
				<el-image
				
				      style="width: 48px; height: 48px"
				      :src="scope.row.imageUrl"
				      fit="cover">
								<div slot="error" class="image-slot">
								        <i class="el-icon-picture-outline"></i>
								      </div>
									  </el-image>
			</template>
		</el-table-column>
		<el-table-column sortable prop="assetCode" label="资产编码" header-align="center" align="center" width="110"></el-table-column>
		<el-table-column sortable  prop="assetName" label="资产名称" header-align="center" align="center" width="110">
			
			<template slot-scope="scope">
			  <el-button  type="text" size="medium">{{ scope.row.assetName}}</el-button>
			</template>
		</el-table-column>
		<el-table-column prop="classifyName" label="资产类别" header-align="center" align="center" width="110"></el-table-column>
        <el-table-column prop="specification" label="规格型号" header-align="center" align="center" width="150"></el-table-column>
		<el-table-column prop="dsn" label="设备序列号" header-align="center" align="center" width="150"></el-table-column>
		<el-table-column prop="price" label="单价(元)" header-align="center" align="center"></el-table-column>
		<el-table-column prop="count" label="数量" header-align="center" align="center"></el-table-column>
        <el-table-column prop="unit" label="单位" header-align="center" align="center"></el-table-column>
		
		
		<el-table-column prop="useCompany" label="使用公司" header-align="center" align="center" width="110"></el-table-column>
		<el-table-column prop="useDept" label="使用部门" header-align="center" align="center"></el-table-column>
		<el-table-column prop="userName" label="使用人" header-align="center" align="center"></el-table-column>
		<el-table-column prop="areaName" label="区域名称" header-align="center" align="center"></el-table-column>
		<el-table-column prop="storageLocation" label="存放地点" header-align="center" align="center"></el-table-column>
		<el-table-column prop="managerName" label="管理员" header-align="center" align="center"></el-table-column>
		<el-table-column prop="ownedCompany" label="所属公司" header-align="center" align="center"></el-table-column>
		<el-table-column prop="source" label="来源" header-align="center" align="center"></el-table-column>
		<el-table-column prop="acquisitionDate" label="入手日期" header-align="center" align="center" width="110"></el-table-column>
		<el-table-column prop="supplier" label="供应商" header-align="center" align="center"></el-table-column>
		<el-table-column prop="usablePeriod" label="使用期限(月)" header-align="center" align="center" width="130"></el-table-column>
		<el-table-column prop="supplierContact" label="供应商联系人" header-align="center" align="center" width="130"></el-table-column>
		<el-table-column prop="supplierPhone" label="供应商联系方式" header-align="center" align="center" width="150"></el-table-column>
		<el-table-column prop="maintenanceExpiration" label="维保到期" header-align="center" align="center" width="110"></el-table-column>
		<el-table-column prop="maintenanceNotes" label="维保说明" header-align="center" align="center"></el-table-column>
		<el-table-column prop="creatorName" label="创建人" header-align="center" align="center"></el-table-column>
		<el-table-column prop="createDate" label="创建时间" header-align="center" align="center" width="180"></el-table-column>
		<el-table-column prop="updaterName" label="更新者" header-align="center" align="center"></el-table-column>
		<el-table-column prop="updateDate" label="更新时间" header-align="center" align="center" width="180"></el-table-column>
        <el-table-column prop="notes" label="备注" header-align="center" align="center" width="180"></el-table-column>
        
        
        <el-table-column :label="$t('handle')" fixed="right" header-align="center" align="center" width="150">
          <template slot-scope="scope">
            <el-button v-if="$hasPermission('assets:asset:update')" type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">{{ $t('update') }}</el-button>
            <el-button v-if="$hasPermission('assets:asset:delete')" type="text" size="small" @click="deleteHandle(scope.row.id)">{{ $t('delete') }}</el-button>
          </template>
        </el-table-column>
      </el-table>
      <el-pagination
        :current-page="page"
        :page-sizes="[10, 20, 50, 100]"
        :page-size="limit"
        :total="total"
        layout="total, sizes, prev, pager, next, jumper"
        @size-change="pageSizeChangeHandle"
        @current-change="pageCurrentChangeHandle">
      </el-pagination>
      <!-- 弹窗, 新增 / 修改 -->
      <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
    </div>
  </el-card>
</template>

<script>
import mixinViewModule from '@/mixins/view-module'
import AddOrUpdate from './asset-add-or-update'
export default {
  mixins: [mixinViewModule],
  data () {
    return {
      mixinViewModuleOptions: {
        getDataListURL: '/assets/asset/page',
        getDataListIsPage: true,
        exportURL: '/assets/asset/export',
        deleteURL: '/assets/asset',
        deleteIsBatch: true
      },
      dataForm: {
      },
	  classifyList:[]
    }
  },
  created() {
  },
  methods:{

  },
  components: {
    AddOrUpdate
  }
}
</script>
